﻿#pragma once
#pragma execution_character_set("utf-8")
// 本文件为utf-8 编码格式

#ifndef __GD__ImageStickerItemView__
#define __GD__ImageStickerItemView__

#include "CrossApp.h"
#include "../GdDefine.h"

class ImageStickerItemView :
	public CAView
{
public:
	static ImageStickerItemView* createWithFrame(const CCRect& rect, GdBean& imageStickerBean);
	ImageStickerItemView(GdBean& imageStickerBean);

	virtual ~ImageStickerItemView();

	void initView();
	// 设置是否可以编辑
	void setCanEdit(bool edit);

	void adjustBounce(const CCSize& viewSize); // 调整标签边界在视图类
	GdBean getImageStickerBean();
public:
	void onFullBtnTouchMoved(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onFullBtnTouchMovedOutSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onFullBtnTouchDown(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onFullBtnTouchUpInSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onFullBtnTouchUpOutSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCloseBtnClick(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCtlBtnTouchMoved(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCtlBtnTouchMovedOutSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCtlBtnTouchDown(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCtlBtnTouchUpInSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
	void onCtlBtnTouchUpOutSide(CrossApp::CAControl *control, CrossApp::CCPoint point);
protected:
	void dtImageSize(float dt); // 变化图片视图大小
	void fixViewSize(); // 刷新整体视图大小
	float getCtlToCenterAngle(CCPoint ctlPoint);
	float getCtlToCenterDistance(CCPoint ctlPoint);
protected:
	
private:
	bool canMove;
	CCSize winSize;
	CCSize minSize;
	int space;
	bool isClickMark;
	CCPoint touchPoint; // 移动记录点
	CCPoint ctlPoint; // 

	GdBean imageStickerBean;

	CAView *imageView; // 图片视图
	CAView *btnView; // 按钮视图
	CAImageView *bgImage;
	CAScale9ImageView *imageKuang;
	CAImageView *ctlImage;
	CAImageView *closeImage;

	CAButton *fullBtn;
	CAButton *closeBtn;
	CAButton *ctlBtn;
};
#endif /* defined(__HelloCpp__ViewController__) */